package com.note.simpleshop.entity;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
@Table(name = "tb_token", schema = "simpleshop", catalog = "")
public class TbToken {
    private String id;
    private Timestamp createTime;
    private Timestamp expireTime;
    private String token;
    private String userId;

    @Id
    @Column(name = "id")
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Basic
    @Column(name = "create_time")
    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    @Basic
    @Column(name = "expire_time")
    public Timestamp getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(Timestamp expireTime) {
        this.expireTime = expireTime;
    }

    @Basic
    @Column(name = "token")
    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    @Basic
    @Column(name = "user_id")
    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TbToken tbToken = (TbToken) o;
        return Objects.equals(id, tbToken.id) &&
                Objects.equals(createTime, tbToken.createTime) &&
                Objects.equals(expireTime, tbToken.expireTime) &&
                Objects.equals(token, tbToken.token) &&
                Objects.equals(userId, tbToken.userId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, createTime, expireTime, token, userId);
    }
}
